//
//  WYChannelModel.m
//  WYNews
//
//  Created by 曾佳豪 on 2017/3/18.
//  Copyright © 2017年 haodada.com. All rights reserved.
//

#import "WYChannelModel.h"
#import <YYModel.h>
//使用cooapods 导入头文件 是以库的形式导入
@implementation WYChannelModel


+(NSArray *)channelModelArr{
    
    //1.获取频道json的二进制数据
    NSData *data =[NSData dataWithContentsOfURL:[[NSBundle mainBundle]URLForResource:@"topic_news.json" withExtension:nil ]];
    //2.字典转模型
    NSDictionary *dic =[NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
    //获取最外层的数组
    NSArray *dicArr =dic[@"tList"];
    //用YYModel转模型
    NSArray *modelArr =[NSArray yy_modelArrayWithClass:[WYChannelModel class] json:dicArr];
    modelArr =[modelArr sortedArrayUsingComparator:^NSComparisonResult(WYChannelModel  * obj1, WYChannelModel  *  obj2) {
        return [obj1.tid compare:obj2.tid];
    }];
    

    return modelArr;
}
-(NSString *)description{
    return  [self yy_modelDescription];
}
@end
